package org.apereo.cas.back;

import org.apereo.cas.entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

public class back01 {

//    public static void main(String[] args) {
//        String driver = "com.mysql.cj.jdbc.Driver";
//        String url = "jdbc:mysql://localhost:3306/intel-platdb?useUnicode=true&characterEncoding=utf8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true\n";
//        String username = "root";
//        String password = "root";
//
//        // JDBC模板依赖于连接池来获得数据的连接，所以必须先要构造连接池
//        DriverManagerDataSource dataSource = new DriverManagerDataSource();
//        dataSource.setDriverClassName(driver);
//        dataSource.setUrl(url);
//        dataSource.setUsername(username);
//        dataSource.setPassword(password);
//
//        String sql = "SELECT * FROM egin_sys_user WHERE login_name = ?";
//        // 创建JDBC模板
//        JdbcTemplate jdbcTemplate = new JdbcTemplate();
//        User info = (User) jdbcTemplate.queryForObject(sql, new Object[]{username}, new BeanPropertyRowMapper(User.class));
//
//
//        System.out.println("database username : " + info.getLoginName());
//        System.out.println("database password : " + info.getUserPassword());
//    }
}
